/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-08-13
 * Time: 20:02
 */
public class Test2 {

    public static int fun(String s) {
        char[] ch = s.toCharArray();

        if(s.length() == 0) {
            return 0;
        }

        int count = 1;
        for(int i = 1; i < ch.length; i++) {
            if(ch[i] != ch[i -1]) {
                count++;
            }else {
                break;
            }
        }
        return count;
    }


    public static void main(String[] args) {
        String s = "abcc";
        String s1 = "aab";
        String s2 = "";
        String s3 = "ada";
        System.out.println(fun(s));
        System.out.println(fun(s1));
        System.out.println(fun(s2));
        System.out.println(fun(s3));
    }
}
